import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeView from "../views/HomeView.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "layout",
    redirect: '/home',
    component: () =>
      import(/* webpackChunkName: "layout" */ "@/views/layout/indexView.vue"),
    children: [
      {
        path: "/home",
        name: "home",
        component: () =>
          import(
            /* webpackChunkName: "home" */ "@/views/home/indexView.vue"
          ),
      },
      {
        path: "/car",
        name: "car",
        component: () =>
          import(
            /* webpackChunkName: "car" */ "@/views/car/indexView.vue"
          ),
      },
      
    ],
  },
  {
    path: "/detail/:id",
    name: "detail",
    component: () =>
      import(
        /* webpackChunkName: "detail" */ "@/views/detail/indexView.vue"
      ),
    props: true
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
